package com.zhekou.web.action;

import com.zhekou.bo.Product;
import com.zhekou.service.ProductService;
import com.zhekou.util.JdbcPage;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.UrlBinding;
import net.sourceforge.stripes.integration.spring.SpringBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by IntelliJ IDEA.
 * User: unicorn3964
 * DateTime: 12-11-21 下午4:16
 */
@UrlBinding("/product.do")
public class ProductAction extends BaseAction {
    private static final Logger logger = LoggerFactory.getLogger(ProductAction.class);
    @SpringBean
    private ProductService productService;
    private JdbcPage<Product> page;
    private int id;
    private int style;
    private Product product;

    @DefaultHandler
    public Resolution list() {
        page = productService.getList(curPage, pageSize);
        return getResolution("list");
    }

    public Resolution detail() {
        product = productService.get(id);
        return getResolution("detail");
    }

    public void setProductService(ProductService productService) {
        this.productService = productService;
    }

    public void setPage(JdbcPage<Product> page) {
        this.page = page;
    }

    public JdbcPage<Product> getPage() {
        return page;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Product getProduct() {
        return product;
    }

    public int getStyle() {
        return style;
    }

    public void setStyle(int style) {
        this.style = style;
    }
}
